< previous page page_32 next page >

Page 32
0032-01.jpg
Figure 2.10.
Copying controls on a form.
Tip.gif
The Textbox and Label controls on this form are part of a control array. Because using control arrays reduces the total number of distinct controls on your forms, they reduce the amount of Windows resources your program uses. You can copy controls as many times as you likeeven across forms and projects!

You just created duplicates of the BOOLEAN input control. All you need to do now is change the label caption to Byte and the text box DataField property to ByteField, and you have two new controls on your form with minimal typing. Your form should look like the one in Figure 2.11.
0032-02.jpg
Figure 2.11.
Adding the BYTE data type to your form.
Save and run the program. This time, after pressing the Add button, enter the value 256 into the Byte input control and press the Update button. You see that when Visual Basic attempts to store the value to the data table, a runtime error is reported. Byte data fields can only accept positive values between 0 and 255. Trying to save any other value in this data field causes the Microsoft Jet data engine to report an error to Visual Basic.

 
< previous page page_32 next page >

If you like this book, buy it!